package org.coco24.pmstudio.widget

import com.badlogic.gdx.scenes.scene2d.Actor
import com.kotcrab.vis.ui.building.StandardTableBuilder
import com.kotcrab.vis.ui.building.TableBuilder
import com.kotcrab.vis.ui.util.adapter.AbstractListAdapter
import com.kotcrab.vis.ui.util.adapter.ArrayListAdapter
import com.kotcrab.vis.ui.widget.VisLabel
import com.kotcrab.vis.ui.widget.VisTable
import com.kotcrab.vis.ui.widget.VisTextButton
import org.coco24.pmstudio.`interface`.SimpleWindowCallback
import org.coco24.pmstudio.util.UIUtils.setOnChanged
import org.coco24.pmstudio.window.NewWindow
import java.lang.IllegalStateException

open class OperationBar<ItemT, ViewT: Actor>(adapter: ArrayListAdapter<ItemT, ViewT>): VisTable()
{
    val addButton = VisTextButton("+")
    val deleteButton = VisTextButton("×")

    init
    {
        add(StandardTableBuilder().append(addButton).append(deleteButton).row().build())
        pack()
//        setOnChanged(deleteButton, Runnable {
//            if(adapter.selection.size == 0) return@Runnable
//            adapter.removeAll(adapter.selection.toList())
//        })
    }
}